## nodw ######################################################
cmake_minimum_required(VERSION 2.6)
## 工程名 ####################################################
project(nodw)
## 工程相关设置 ##############################################
if (WIN32)
set(VS_VERSION "vs10" CACHE STRING "vs version")
add_definitions(-D__WINDOWS__)
add_definitions(-D_WIN32_WINNT=0x0501)
add_definitions(-D__LCC__)
add_definitions(-W3)
else()
add_definitions(-Wall)
    if (CMAKE_COMPILER_IS_GNUCXX)
        add_definitions(-std=gnu++0x)
    else ()
        add_definitions(-std=stdc++11)
    endif()
endif()

## 第三方库 ###################################################
if (WIN32)
set(BOOST_INC ${PROJECT_SOURCE_DIR}/dep/boost)
set(BOOST_LIB "" CACHE PATH "boost library directory")
## libevent
set(LIBEVENT_INC ${PROJECT_SOURCE_DIR}/dep/win/libevent/include)
set(LIBEVENT_LIB ${PROJECT_SOURCE_DIR}/dep/win/libevent/lib/${VS_VERSION})
set(LIBEVENT_LIBRARIES libevent libevent_core libevent_extras)
## mysql
set(MYSQL_INC ${PROJECT_SOURCE_DIR}/dep/win/mysql/include)
set(MYSQL_LIB ${PROJECT_SOURCE_DIR}/dep/win/mysql/lib)
set(MYSQL_LIBRARIES libmysql)
## openssl
set(OPENSSL_INC ${PROJECT_SOURCE_DIR}/dep/win/openssl)
set(OPENSSL_LIB ${PROJECT_SOURCE_DIR}/dep/win/openssl/lib)
set(OPENSSL_LIBRARIES libeay32)
else()
set(BOOST_INC ${PROJECT_SOURCE_DIR}/dep/boost)
set(BOOST_LIB "" CACHE PATH "boost library directory")
set(LIBEVENT_INC "" CACHE PATH "libevent include directory")
set(LIBEVENT_LIB "" CACHE PATH "libevent library directory")
set(MYSQL_INC "" CACHE PATH "mysql include directory")
set(MYSQL_LIB "" CACHE PATH "mysql library directory")
set(OPENSSL_INC "" CACHE PATH "openssl include directory")
set(OPENSSL_LIB "" CACHE PATH "openssl library directory")
endif()

include_directories(
    ${BOOST_INC}
    ${LIBEVENT_INC}
    ${MYSQL_INC}
    ${OPENSSL_INC}
    ${PROJECT_SOURCE_DIR}
)

link_directories(
    ${BOOST_LIB}
    ${LIBEVENT_LIB}
    ${MYSQL_LIB}
    ${OPENSSL_LIB}
)

add_subdirectory(node)
add_subdirectory(shared)
add_subdirectory(realmd)
add_subdirectory(game)